<template>
	<div class="llf_content">
		<SearchHeader @search="onSearch" :selectform="selectform" placeholder="操作人员搜索" :isDate="{ bol:true, title:'' }">
			<template v-slot:rightBtn>
				<MyButton class="primary" @click="onPrint" title="导出" />
			</template>
		</SearchHeader>
		<ReportList :tableData="dataSource" />
		<MyPagination :total="total" @change="onPaginationChange" ref="pageRef" />
	</div>
</template>

<script lang="ts" setup>
	import { onMounted, ref } from "vue";
	import { Modal } from 'ant-design-vue';
	import { findList } from "@/api/system";
	import options from "@/common";
	import message from "@/utils/message";
	import ReportList from "./component/ReportList.vue";
	
	const selectform = ref<any>([
		{ title: '操作类型', childer:[], width: '50px', contWidth: '250px',class: 'type', },
	]);
	const dataSource = ref([{name:'s',id:1}]);
	const total = ref(0);
	const pageRef = ref();
	const sreach = ref({ page:1, size:50 });
	
	async function getFn(){
		const res = await findList(sreach.value);
		if(!res) return;
		total.value = res.total;
		dataSource.value = res.list;
	}
	
	const onSearch = (inputValue: string, obj: any,date:any) => {	//搜索---子组件
		let SEARCH_VALUE = {};
		SEARCH_VALUE = obj;
		if (date[0] !== '' && date.length > 0){
			SEARCH_VALUE["startTime"]  = Date.parse(new Date(date[0]) as any) / 1000;
			SEARCH_VALUE["endTime"]  =  Date.parse(new Date(date[1]) as any) / 1000;
		}else{
			SEARCH_VALUE["startTime"] = SEARCH_VALUE["endTime"] = '';
		}
		SEARCH_VALUE["keyword"] = inputValue;
		console.log(SEARCH_VALUE, "SEARCH_VALUE")
		sreach.value.page = 1;
		pageRef.value.changeCurrent();
		sreach.value = { ...sreach.value, ...SEARCH_VALUE };
		getFn();
	};
	
	const onPaginationChange = (value: { page: number; pageSize: number }) => { // 页码与页面数量
		const { pageSize, page } = value;
		sreach.value = { ...sreach.value, page, size: pageSize };
		getFn();
	};
	
	onMounted(()=>{
		getFn();
	});
</script>

<style>
</style>